# %%
from zhipuai import ZhipuAI
client = ZhipuAI(api_key="") # 请填写您自己的APIKey

# %%
t = []
temp = """
Information About You

Select the information that best describes how you anticipate filing your 2025 tax return.

All fields marked with an asterisk (*) are required.
What filing status will you use for your tax return?*
Single
Married filing jointly
Married filing separately
Head of Household
Qualifying Widow(er)
"""
t.append(temp)

temp = """
Head of Household

Generally, you may claim Head of Household filing status on your tax return only if you are unmarried and pay more than 50% of the costs of keeping up a home for yourself and your dependent(s) or other qualifying individuals.

For more information see About Publication 501, Dependents, Standard Deduction, and Filing Information.
Qualifying widow(er)

You are eligible to file your return as a qualifying widow(er) with dependent child if you meet all of the following tests.

    You were entitled to file a joint return with your spouse for the year your spouse died. It does not matter whether you actually filed a joint return.
    Your spouse died no more than two years before the year for which you are filing your return and you did not remarry before the end of the year for which you are filing your return.
    You have a child or stepchild whom you may claim as a dependent. This does not include a foster child.
    This child lived in your home all year, except for temporary absences. There are also exceptions for a child who was born or died during the year and for a kidnapped child.
    You paid more than half the cost of keeping up a home for the year.

For more information see About Publication 501, Dependent, Standard Deduction, and Filing Information.
"""
t.append(temp)

temp = """
Do you (or will you) or your spouse have a job or a pension that regularly withholds federal income taxes from your paychecks or pension payments?*
Yes
No
"""
t.append(temp)

temp = """
Periodic paychecks or payments & federal withholding

If you're an employee, your employer probably withholds income tax from your paycheck and pays it to the IRS in your name. If you receive periodic pension payments, you may have Federal income tax withheld from those, as well. You can use this Estimator to prepare a new Form W-4 for your employer and a new Form W-4P for your pension provider to ensure that you are not having too much or too little income tax withheld by the end of this year.
"""
t.append(temp)

temp = """
Select any that apply:
I plan to claim dependents on my tax return
I will be 65 or older on Jan. 1, 2026
My spouse will be 65 or older on Jan. 1, 2026
I am blind
My spouse is blind
I can be claimed as a dependent on someone else’s tax return
"""
t.append(temp)

temp = """
Describe this source of income:*
Salary
An hourly job
A pension
Social Security
None of the above
"""
t.append(temp)

temp = """
This income source is for:*
Myself
My spouse
"""
t.append(temp)

temp = """
Select what best describes when you earn income from this job:*
All year (Jan. 1 to Dec. 31)
I currently hold this job, but only for a portion of this year
I had this job earlier this year
I do not hold this job yet; I expect to start this job later this year
"""
t.append(temp)

temp = """
How frequently are you paid?*
Weekly
Every two weeks
Twice monthly
Once a month
"""
t.append(temp)

temp = """
Using your most recent paystub:
When did your most recent pay period end?*

MM/DD/YYYY
What was your most recent pay date?

MM/DD/YYYY
Enter wages or salary per pay period*
Enter wages or salary year-to-date*
"""
t.append(temp)

temp = """
Enter federal taxes paid per pay period*
Enter federal taxes paid year-to-date*

Federal Income Tax Withheld

The amount of money withheld by your employer/pension for federal income tax is listed on each pay statement you receive. This does not include state, local, Medicare, Social Security, or other amounts withheld.
"""
t.append(temp)

temp = """
Select any that apply for this job:
I contribute to a 401k (Do not include contributions to a Roth 401k)
I contribute to a health insurance plan, HSA, or FSA
I am getting a bonus
I got a bonus
None of the above
"""
t.append(temp)

temp = """
Do you have any other sources of income?
Net self-employment income
Spouse's net self-employment income
Investment income
Unemployment insurance income
Other sources of income
None of the above
"""
t.append(temp)

temp = """
Withholding and estimated tax payments on other sources of income
Withholding from other sources of income
Enter the amount of taxes withheld to date this year from both you and your spouse's other sources of income
Estimated tax payments
Enter the amount of estimated tax payments that you and your spouse made to date this year
"""
t.append(temp)

temp = """
Adjustments to Income

Adjustments reduce the amount of your income subject to tax. Many taxpayers don't have large enough adjustments to income to have a significant impact on their tax obligation.
Select any adjustments to income you plan to make when you file your 2025 income taxes or go to the next step.
Student Loan Interest Deduction
Educator Expense Deduction
Deduction for contributions to Traditional IRAs (not Roth IRAs or contributions from payroll)
Health Savings Account Deduction (excluding amounts deducted from payroll)
Moving Expenses for Members of the Armed Services
Alimony paid
Penalty for Early Withdrawal of Savings
Certain business credits for reservists, performing artists, and fee-based government officials
"""
t.append(temp)

temp = """
Student Loan Interest Deduction

Student loan interest is interest you paid during the year on a qualified student loan. It includes both required and voluntarily pre-paid interest payments. You may deduct the lesser of $2,500 or the amount of interest you actually paid during the year.

For more information see IRS Topic 456
"""
t.append(temp)

temp = """
Educator Expense Deduction

If you're an eligible educator, you can deduct up to $300 ($600 if married filing jointly and both spouses are eligible educators, but not more than $300 each) of unreimbursed trade or business expenses. Qualified expenses are amounts you paid or incurred for participation in professional development courses, books, supplies, computer equipment (including related software and services), other equipment, and supplementary materials that you use in the classroom.

For more information see IRS Topic 458
"""
t.append(temp)

temp = """
IRA Deduction

You may be able to claim a deduction on IRA contributions made outside of your payroll contributions.
Do not include amounts that you included on the Income & Withholding page.

For more information see IRA Deduction Limits
"""
t.append(temp)

temp = """
Health Savings Account Deduction

You may be eligible to deduct health savings account contribution not included in your payroll deductions.
Do not include amounts you included on the Income & Withholding page.

For more information visit About Publication 969, Health Savings Accounts and Other Tax-Favored Health Plans
"""
t.append(temp)

temp = """
Moving Expenses for Members of the Armed Services

If you're a member of the Armed Forces on active duty, you may be eligible to deduct moving expenses if your move was due to a military order and permanent change of station. You may be able to deduct your unreimbursed moving expenses for you, your spouse and dependents.

For more information visit Tax Topic 455
"""
t.append(temp)

temp = """
Alimony Paid

Amounts paid to a spouse or a former spouse under a divorce or separation instrument (including a divorce decree, a separate maintenance decree, or a written separation agreement) may be alimony for federal tax purposes. Alimony is deductible by the payer spouse, and the recipient spouse must include it in income.

Note: You can't deduct alimony or separate maintenance payments made under a divorce or separation agreement (1) executed after 2019, or (2) executed before 2020 but later modified if the modification expressly states the repeal of the deduction for alimony payments applies to the modification. Alimony and separate maintenance payments you receive under such an agreement are not included in your gross income. For more information visit Tax Topic 452
"""
t.append(temp)

temp = """
Penalty for Early Withdrawal of Savings

If you withdraw funds from a certificate of deposit or other deferred interest account before maturity, you may be charged a penalty. The Form 1099-INT or 1099-OID given to you by the financial institution will show the penalty you are charged.

For more information see Hardships, Early Withdrawals and Loans
"""
t.append(temp)

temp = """
Certain Business Expenses

Form 2106 is used by Armed Forces reservists, qualified performing artists, fee-basis state or local government officials, and employees with impairment-related work expenses to figure their deductible business expenses.

Due to the suspension of miscellaneous itemized deductions subject to the 2% floor under section 67(a) of the Internal Revenue Code, employees who do not fit into one of the listed categories may not claim adjustments for these expenses.

For more information visit Instructions for Form 2106
"""
t.append(temp)

temp = """
Standard or Itemized Deductions

Standard or itemized deductions reduce the amount of your income subject to tax.

Most people take the standard deduction, but you may be itemizing your deductions if you have a mortgage, large gifts to charity, or large medical expenses.

Your standard deduction amount is calculated to be $30,000

All fields marked with an asterisk (*) are required.
Would you like to see if itemizing your deductions would be to your advantage?*
Yes, see if I will Itemize (If your itemized deductions are less than your standard deduction, the tool will use the standard deduction)
No, just use the standard deduction
"""
t.append(temp)

temp = """
Standard Deduction

The standard deduction is a specific dollar amount that reduces the amount of income subject to tax. Your standard deduction amount depends on your filing status, dependency status, age, whether or not you are blind. Alternatively, you may itemize your deductions, which would be to your advantage if your total itemized deductions exceed your standard deduction. If you're unsure if you should take the standard deduction or itemize you can view deductions and input them. The tool will then determine which is higher for you.

For more information about determining if you should take the standard deduction or itemize see Tax Topic 501
"""
t.append(temp)

temp = """
Select any that apply:
Qualified mortgage interest and investment interest expenses
State and local taxes you paid
Medical and dental expenses
Gifts to charity
Casualty losses
Other itemized deductions
"""
t.append(temp)

temp = """
Interest You Paid

Interest is an amount you pay for the use of borrowed money. Some interest can be claimed as a deduction or as a credit. To deduct interest you paid on a debt, review each interest expense to determine how it qualifies and where to take the deduction. Itemized Deductions include:

    Investment interest (limited to your net investment income)
    Qualified mortgage interest including points (if you're the buyer)

For more information visit Tax Topic 505
"""
t.append(temp)

temp = """
Taxes you paid

There are four types of deductible nonbusiness taxes:

    State, local, and foreign income taxes
    State and local general sales taxes
    State and local real estate taxes
    State and local personal property taxes

For more information see Tax Topic 503

Note: this deduction is limited to a total of $10,000 ($5,000 for married taxpayers filing separately). The tool will apply this limit for you, if necessary.
"""
t.append(temp)

temp = """
Medical and Dental Expenses

If you want to deduct medical and dental expenses you pay this year for yourself, your spouse and your dependents, you can deduct only the amount of your total expenses that exceed 7.5% of your adjusted gross income.

Enter your total estimated medical and dental expenses. You may include the total estimated amount you pay for health insurance premiums, not including any amount your employer pays. The estimator will determine the amount you can claim and reflect it on the results page summary table.

For more information see Tax Topic 502
"""
t.append(temp)

temp = """
Charity

To be a deductible, you must make charitable contributions to qualified organizations. Contributions to individuals are never deductible. To determine if the organization that you contributed to qualifies as a charitable organization for income tax deduction purposes, refer to our Tax Exempt Organization Search

For more information see Publication 526 or Tax Topic 506
"""
t.append(temp)

temp = """
Casualty Losses

Generally, you may deduct casualty and theft losses relating to your home, household items, and vehicles on your federal income tax return if the loss took place in a federally declared disaster area (declared by the President). You may not deduct casualty and theft losses covered by insurance, unless you file a timely claim for reimbursement and you reduce the loss by the amount of any reimbursement or expected reimbursement.

For more information see Tax Topic 515
"""
t.append(temp)

temp = """
Other Deductions

For information on other deductions see Tax Topic 529
"""
t.append(temp)

temp = """
Tax Credits

Tax credits are amounts you subtract directly from your tax obligation.

You previously stated you planned to claim dependents. Use the open Child and Dependent Credits section to provide details for any dependent-related tax credits.
How old will you be on January 1 of next year?*
How old will your spouse be on January 1 of next year?*
"""
t.append(temp)

temp = """
Child and Dependent Credits

You indicated you have a dependent(s). Enter age for each dependent you wish to claim
Child Tax Credit
Enter the age the child will be on December 31, 2025
Child and Dependent Care Credit
Enter the number of qualifying children for the Child and Dependent Care Credit
Enter the amount of qualifying work-related childcare expenses
"""
t.append(temp)

temp = """
Child and Dependent Care Credit

You may be able to claim the child and dependent care credit if you paid expenses for the care of a qualifying individual to enable you (and your spouse, if filing a joint return) to work or actively look for work.

For more information, see Tax Topic 602
"""
t.append(temp)

temp = """
Qualifying work-related childcare expenses

The total expenses that you may use to calculate the credit may not be more than $3,000 (for one qualifying individual) or $6,000 (for two or more qualifying individuals). Expenses paid for the care of a qualifying individual are eligible expenses if the primary reason for paying the expense is to assure the individual's well-being and protection. If you received dependent care benefits that you exclude or deduct from your income, you must subtract the amount of those benefits from the dollar limit that applies to you.

For more information, see Tax Topic 602
"""
t.append(temp)

temp = """
The Earned Income Tax Credit

The EITC or EIC, is a benefit for working people with low to moderate income. To qualify, you must meet certain requirements and file a tax return, even if you do not owe any tax or are not required to file. EITC reduces the amount of tax you owe and may give you a refund.

We recommend you use EITC Assistant to determine your eligibility for Earned Income Tax Credit.

A qualifying child is:

    Son, daughter, stepchild, “foster child”, brother, sister, stepbrother, stepsister, half-brother, half-sister, or a descendant of any of them (for example, your grandchild, niece, or nephew)
    Under the age of 19 at the end of this year and younger than you (or your spouse, if filing jointly), or under the age of 24 at the end of this year, a “student”, and younger than you (or your spouse, if filing jointly), or any age and permanently and totally disabled
    who isn't filing a joint return for this year or is filing a joint return for this year only to claim a refund of withheld income tax or estimated tax paid (see Pub. 596 for examples)
    Who lived with you in the United States for more than half of this year

For more information, see Tax Topic 601
"""
t.append(temp)

temp = """
Adoption Tax Credit
Enter the amount of Adoption Tax Credit for which you expect to be eligible

Tax benefits for adoption include both a tax credit for qualified adoption expenses paid to adopt an eligible child and an exclusion from income for employer-provided adoption assistance.

For more information, see Tax Topic 607
"""
t.append(temp)

temp = """
Adoption Tax Credit
Enter the amount of Adoption Tax Credit for which you expect to be eligible

Tax benefits for adoption include both a tax credit for qualified adoption expenses paid to adopt an eligible child and an exclusion from income for employer-provided adoption assistance.

For more information, see Tax Topic 607
"""
t.append(temp)

temp = """
Foreign Tax Credit
Enter the amount of Foreign Tax Credit for which you expect to be eligible
Foreign Tax Credit

If you paid or accrued foreign taxes to a foreign country or U.S. possession and are subject to U.S. tax on the same income, you may be able to take either a credit or an itemized deduction for those taxes.

For more information, see Foreign Tax Credit
"""
t.append(temp)

temp = """
Educational
American Opportunity Tax Credit
Enter the number of students you are claiming for the American Opportunity Tax Credit

If you expect to be eligible for the American Opportunity Credit, enter the amount of credit for which you expect to be eligible
Educational Tax Credits

Expenses that qualify for the American Opportunity Tax Credit (AOTC) are qualified tuition and related expenses paid by the taxpayer during the taxable year. To determine your eligibility use the Am I Eligible to Claim an Education Credit?
The American Opportunity Tax Credit has a cap of $2,500 per student
Lifetime Learning Credit
If you expect to be eligible for the Lifetime Learning Credit, enter the amount of credit for which you expect to be eligible
Educational Tax Credits

Expenses that qualify for the Lifetime Learning Credit (LLC) are qualified tuition and related expenses paid by the taxpayer during the taxable year. To determine your eligibility use the Am I Eligible to Claim an Education Credit?
The Lifetime Learning Credit has an annual cap of $2000
"""
t.append(temp)

temp = """
Retirement Savings
Enter the amount of any retirement savings contributions credit for which you expect to be eligible
Eligible Retirement Savings

If you make eligible contributions to certain eligible retirement plans or to an individual retirement arrangement (IRA), you may be able to take a tax credit. The amount of the saver's credit you can get is generally based on the contributions you make and your credit rate.

For more information, see Tax Topic 610
"""
t.append(temp)

temp = """
Residential Energy Credit
Residential Energy Credit

You may be able to take these credits if you made energy saving improvements to your principal residence during the taxable year.

For more information, see Instructions for Form 5695
Mortgage Interest Credit (for those with a qualified Mortgage Credit Certificate)
Mortgage Interest Credit (for those with a qualified Mortgage Credit Certificate)

You may be able to claim this credit if you were issued a qualified Mortgage Credit Certificate (MCC) by a state or local governmental unit or agency under a qualified mortgage credit certificate program.

For more information, see About Form 8396, Mortgage Interest Credit
"""
t.append(temp)

temp = """
Elderly or Disabled
Enter the amount of elderly or disabled credit for which you expect to be eligible
Elderly or Disabled Tax Credit

A credit for taxpayers who are aged 65 or older or retired on permanent and total disability and received taxable disability income for the tax year; AND with an adjusted gross income OR the total of nontaxable Social Security, pensions annuities or disability income under specific limits.

For more information, see Credit for the Elderly or the Disabled at a Glance
"""
t.append(temp)

temp = """
Business
General business credit
Business Credits

If you own or operate a your own business you may be eligible for business credits.

In order to determine your eligibility and amounts visit Business Tax Credits
"""
t.append(temp)

temp = """
Alternative Minimum Credit
Enter the amount of prior-year Alternative Minimum Tax credit
Alternative Minimum Tax Credit

If you're not liable for AMT this year, but you paid AMT in one or more previous years, you may be eligible to take a special minimum tax credit against your regular tax this year. If eligible, you should complete and attach Form 8801, Credit for Prior Year Minimum Tax - Individuals, Estates, and Trusts to claim the minimum tax credit.

For more information visit About Form 8801, Credit for Prior Year Minimum Tax - Individuals, Estates, and Trusts
"""
t.append(temp)

temp = """
Energy Efficient Vehicles
Enter the amount of alternative motor vehicle credit for which you expect to be eligible
Alternative Motor Vehicle Credit

You may be able to take a credit if you place a qualified fuel cell vehicle in service during the tax year. Generally, you can rely on the manufacturer's certification to the IRS that a specific make, model and model year vehicle qualifies for the credit and the amount of the credit for which it qualifies.

For more information, see About Form 8910, Alternative Motor Vehicle Credit
Enter the amount of alternative fuel vehicle refueling property credit for which you expect to be eligible
Alternative Fuel Refueling Property Credit

You may be entitled to a credit for alternative fuel vehicle refueling property you placed in service during your tax year.

For more information, see About Form 8911
Enter the amount of qualified plug-in electric vehicle credit for which you expect to be eligible
Qualified Plug-In Electric Vehicle Credit

You may be able to claim a credit for a qualified vehicle. These credits do phase out.

For more information, see IRC 30D New Qualified Plug-In Electric Drive Motor Vehicle Credit
"""
t.append(temp)

# %%
prompts = []
instruct = "我正在使用美国irs的Tax Withholding Estimator，其中有如下文字，请问是什么意思：\n"
for text in t:
    prompts.append(instruct+text)

# %%

contents = []

for prompt in prompts:
    messages = []
    messages.append({"role": "system", "content": "美国税制专家"})
    messages.append({"role": "user", "content": prompt})

    response = client.chat.completions.create(
        model="GLM-4-Flash-250414",  # 填写需要调用的模型编码
        messages = messages,
    )
    content = response.choices[0].message.content

    contents.append(prompt)
    contents.append(content+"\n")

with open("05_out.txt", "w", encoding="utf-8") as f:
    f.write("\n".join(contents))

# %%
